1. Field of the Invention
The present invention relates to Virtual Machine technology, and, more particularly, to memory management for Virtual Machines.
2. Background Art
With Virtual Machine (VM) technology, a user can create and run multiple operating environments on a server at the same time. Each operating environment, or Virtual Machine, requires its own operating system (OS) and can run applications independently. The VM software provides a layer between the computing, storage, and networking hardware and the software that runs on it.
Virtual Machine technology can lower information technology (IT) cost through increased efficiency, flexibility, and responsiveness. Each VM acts as a separate environment, which reduces risk and allows developers to quickly re-create different operating system (OS) configurations or compare versions of applications designed for different OS's. Additional uses for VMs include targeted production server consolidation, hosting of legacy applications (older versions), and computer or server backup.
Virtual Machine technology is therefore one technique for emulating or otherwise virtualizing the behavior of software and/or hardware. Generally, a Virtual Machine is an environment that is launched on a particular processor that is running an operating system. Normally, the operating system installed on such a machine or processor has certain privileges that are not available to user applications. For example, many input/output commands may be privileged, and executable only in the operating system (or privileged) mode. Certain areas of memory, or certain addresses in memory, also may require operating system privilege to be accessed.
For each VM, a separate process is created, and the host operating system (HOS) is responsible for scheduling of both the VMs and other processes in the HOS. Examples of such hosted VMMs include VMware GSX Server, VMware Workstation, MS Virtual PC, MS Virtual Server and SVISTA 2004.
Throughout this discussion, it will also be assumed that the reader is generally familiar with the various addressing modes of the Intel processor architecture, as well as with virtualization techniques for the Intel family of processors. Generally, the Intel architecture has a number of relatively complex addressing schemes, all of which can be used by the processor at various times. Furthermore, due to the need to support legacy software, over the years, the Intel architecture has grown increasingly complex, and therefore, increasingly difficult to virtualize. The practical consequence of this is that the performance of the virtualized operating system is frequently significantly slower than the performance of a non-virtualized code. One of the reasons for this involves the paging structures used by the operating system, and the need to virtualize them.
In the context of virtualization, the problem exists in having to efficiently map the paging structures of the guest operating system to the paging structures of the Virtual Machine Monitor. As far as the guest operating system is concerned, this must be entirely transparent, however, the amount of physical memory that the guest operating system “really” has is usually much less than the amount of physical memory that the guest operating system “thinks” it has. This may be due to the fact that some of the memory is allocated to the Virtual Machine Monitor and to the host operating system. It may be due to the fact that several Virtual Machines are running at the same time, and the physical memory therefore needs to be apportioned between them by the host OS and/or VMM. The consequence of this is that very frequently, guest code running in a particular Virtual Machine will attempt to access a page in memory that the Virtual Machine thinks is mapped into linear space, however, in reality, that page is marked as “not present” and therefore absent in paging translation. This triggers a page fault, throwing control to the VMM, which needs to handle the page fault.
The problem of mapping between guest paging structures and VMM paging structures is something that has significant efficiency implications, because it is a relatively overhead-intensive process. Thus, to improve the efficiency of the Virtual Machine, the number of page faults needs to be minimized and the amount of overhead associated with each page fault needs to be minimized as well.
Accordingly, there is a need in the art for an efficient mechanism for handling page faults in the context of Virtual Machine technology.